﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SCFHS
{
    public partial class Master : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Header.DataBind();
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {

                Data.User user = HttpContext.Current.User as Data.User;
                mnuSysDefinitions.Visible = user.isAdmin;
                string UserRoles = user.userRole;
                if (string.IsNullOrEmpty(UserRoles) || UserRoles == "0")
                {
                    MainMenu.Items.RemoveAt(1);
                }

            }
        }

        protected void btnSignout_Click(object sender, EventArgs e)
        {
            try
            {
                FormsAuthentication.SignOut();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Response.Redirect("~/Default.aspx");
            }
        }
    }
}